package com.smcaiot.jftorg.domain.user;

import cn.hutool.core.util.StrUtil;
import com.smcaiot.core.exception.DomainException;
import com.smcaiot.core.stereotype.DomainService;
import com.smcaiot.jftorg.domain.org.OrgId;
import com.smcaiot.jftorg.south.port.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @Author: cz
 * @Date: 2023/9/26
 * @Description:
 */
@Service
@DomainService
public class UserService {
    @Autowired
    private UserRepository userRepository;

    public User getUser(OrgId userId) {
        DomainException.isTrue(Objects.nonNull(userId) && StrUtil.isNotBlank(userId.value()),
                "参数userId不能为空");
        User user = userRepository.getUser(userId);
        return user;
    }
}
